
//
//  XQMSTableViewCell.m
//  yonghu
//
//  Created by mac on 2018/3/19.
//  Copyright © 2018年 com.DJS. All rights reserved.
//

#import "XQMSTableViewCell.h"

@implementation XQMSTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(CGFloat)creatView{
    self.backgroundColor=[UIColor whiteColor];
    NSString *answer_problem=[_dic objectForKey:@"answer_problem"];
    answer_problem=[NSString stringWithFormat:@"%d.%@",_row,answer_problem];
    
    NSString *answer_content=[_dic objectForKey:@"answer_content"];
    answer_content=[NSString stringWithFormat:@"答:%@",answer_content];
    
    CGSize size=[ZQTools getNSStringSize:answer_problem andViewWight:_mainW*0.7-30 andFont:18];
    CGSize size2=[ZQTools getNSStringSize:answer_content andViewWight:_mainW*0.7-50 andFont:16];
    
    UILabel *label1=[UILabel new];
    [self addSubview:label1];
    [label1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(-15);
        make.top.mas_equalTo(15);
//        make.height.mas_equalTo(size.height);
    }];
    label1.numberOfLines=0;
    label1.text=answer_problem;
    label1.font=[UIFont systemFontOfSize:18];
    label1.textColor=ColorWithRGB(49, 49, 49);
    
    UILabel *label2=[UILabel new];
    [self addSubview:label2];
    [label2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(-15);
        make.top.mas_equalTo(label1.mas_bottom).mas_equalTo(10);
//        make.height.mas_equalTo(size2.height);
    }];
    label2.numberOfLines=0;
    label2.font=[UIFont systemFontOfSize:16];
    NSMutableAttributedString *AttributedStr= [[NSMutableAttributedString alloc]initWithString:answer_content];
    [AttributedStr addAttribute:NSForegroundColorAttributeName value:ColorWithRGB(49, 49, 49) range:NSMakeRange(0, 2)];
    [AttributedStr addAttribute:NSForegroundColorAttributeName value:ColorWithRGB(149, 149, 149) range:NSMakeRange(2, answer_content.length-2)];
    label2.attributedText=AttributedStr;
    
    return size.height+size2.height+30;
    
}
@end
